﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SKS.Controls
{
    public class SmartGrid : DataGridView
    {
        public bool HorizontalScrollBarVisible { get; set; }
        public SmartGrid()
        {
            //this.HorizontalScrollBar.VisibleChanged += HorizontalScrollBar_VisibleChanged;
            this.RowsAdded += SmartGrid_RowsAdded;
        }

        void SmartGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            this.FirstDisplayedScrollingRowIndex = this.Rows.Count - 1;
        }

        void HorizontalScrollBar_VisibleChanged(object sender, EventArgs e)
        {
            this.HorizontalScrollBar.Visible = HorizontalScrollBarVisible;
        }
    }
}
